home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / TEXINFO.3 (.txt) < prev    next >
GNU Info File  |  1994-09-21  |  50KB  |  921 lines

  1. This is Info file ../info/texinfo, produced by Makeinfo-1.55 from the
  2. input file texinfo.txi.
  3.    This file documents Texinfo, a documentation system that uses a
  4. single source file to produce both on-line help and a printed manual.
  5.    This is edition 1.1 of the Texinfo documentation, and is for the
  6. Texinfo that is distributed as part of Version 18 of GNU Emacs.
  7.    Copyright (C) 1988 Free Software Foundation, Inc.
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided that
  13. the entire resulting derived work is distributed under the terms of a
  14. permission notice identical to this one.
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions, except that this permission notice may be stated in a
  18. translation approved by the Foundation.
  19. File: texinfo,  Node: Breaks Blank-Lines Groups,  Prev: Refilling & Noindent,  Up: Formatting Paragraphs
  20. Breaks, Blank Lines and Groups
  21. ==============================
  22.    Texinfo has several commands for making blank lines, for forcing
  23. paragraph and page breaks in the printed manual and for preventing text
  24. from running from one page to the next.
  25.      Force a line break in the printed manual.  This command has no
  26.      effect on the Info file.
  27. `@sp'
  28.      Generate blank lines in both the printed manual and in the Info
  29.      file.
  30. `@br'
  31.      Force a paragraph break in the printed manual.  This command has
  32.      no effect on the Info file.
  33.      Prevent text from being split across two lines in the printed
  34.      manual.  This command has no effect on the Info file.
  35. `@page'
  36.      Start a new page in the printed manual.  This command has no
  37.      effect on the Info file.
  38. `@group'
  39.      Hold text together that must appear on one printed page.  This
  40.      command has no effect on the Info file.
  41. `@need'
  42.      Start a new printed page if required space not on this one.  This
  43.      command has no effect on the Info file.
  44. * Menu:
  45. * Line Breaks:: Force a line break in the printed manual.
  46. * Sp::        Generate blank lines.
  47. * Br::        Force a paragraph break in the printed manual.
  48. * W::        Prevent a paragraph break in the printed manual.
  49. * Page::    Start a new page in the printed manual.
  50. * Group::    Hold text together that must appear on one printed page.
  51. * Need::    Start a new printed page if required space not on this one.
  52. File: texinfo,  Node: Line Breaks,  Next: Sp,  Prev: Breaks Blank-Lines Groups,  Up: Breaks Blank-Lines Groups
  53.    `@*' forces a line break in the printed manual.  It has no effect on
  54. the Info file output, where line breaks follow those in the source file.
  55. If you want a line break at a certain spot in both forms of output,
  56. break the line there in the source file and put `@*' at the end of the
  57. line.
  58. File: texinfo,  Node: Sp,  Next: Br,  Prev: Line Breaks,  Up: Breaks Blank-Lines Groups
  59.    A line containing `@sp N' generates N blank lines of space in either
  60. the printed manual or the Info file.  For example,
  61.      @sp 2
  62. generates two blank lines.
  63. File: texinfo,  Node: Br,  Next: W,  Prev: Sp,  Up: Breaks Blank-Lines Groups
  64.    In a printed manual, a line containing `@br' forces a paragraph
  65. break; in the Info file output, it does nothing (not even a blank line
  66. results from it).
  67. File: texinfo,  Node: W,  Next: Page,  Prev: Br,  Up: Breaks Blank-Lines Groups
  68.    In a printed manual, `@w{TEXT}' outputs TEXT and prohibits line
  69. breaks within TEXT.  `@w' has no effect on the Info file output; it is
  70. the same as would result from just TEXT.
  71. File: texinfo,  Node: Page,  Next: Group,  Prev: W,  Up: Breaks Blank-Lines Groups
  72. @page
  73. -----
  74.    A line containing `@page' starts a new page in a printed manual.  The
  75. line has no effect on Info files since they are not paginated.
  76. File: texinfo,  Node: Group,  Next: Need,  Prev: Page,  Up: Breaks Blank-Lines Groups
  77. @group
  78. ------
  79.    A line containing `@group' begins an unsplittable vertical group,
  80. which must appear entirely on one page.  The group is terminated by a
  81. line containing `@end group'.  These two lines produce no output of
  82. their own, and in the Info file output they have no effect at all.
  83.    If you forget to end a group, you may get strange and unfathomable
  84. error messages when you run TeX.  This is because TeX keeps trying to
  85. put the rest of the Texinfo file into the group and error messages do
  86. not start to get generated until TeX has gone a long way.  It's a good
  87. rule of thumb to look for a missing `@end group' if you get
  88. incomprehensible error messages in TeX.
  89. File: texinfo,  Node: Need,  Prev: Group,  Up: Breaks Blank-Lines Groups
  90. @need
  91. -----
  92.    A line containing `@need N' starts a new page in a printed manual if
  93. fewer than N mils (thousandths of an inch) remain on the current page.
  94. The line has no effect on Info files since they are not paginated.
  95. File: texinfo,  Node: Marking Text,  Next: Conditionals,  Prev: Formatting Paragraphs,  Up: Top
  96. Marking Text Within a Paragraph
  97. *******************************
  98.    In Texinfo, text within a paragraph can be marked in a variety of
  99. ways.  The most important way is to specify whether a word or phrase is
  100. a definition, a metasyntactic variable, a literal example of a program
  101. or what not.
  102.    In addition, there are special commands for inserting single
  103. characters that have special meaning in Texinfo, such as braces, and
  104. for inserting symbols with special handling, such as dots and bullets.
  105. Finally, there are ways to emphasize words.
  106. * Menu:
  107. * Specifying::            Specifying commands, files and so on.
  108. * Braces Atsigns Periods::    Inserting braces, `@' and periods.
  109. * Dots Bullets Tex::        Inserting dots, bullets and the TeX logo
  110. * Emphasis::            Emphasizing text.
  111. File: texinfo,  Node: Specifying,  Next: Braces Atsigns Periods,  Up: Marking Text
  112. Specifying Definitions, Files, Commands etc.
  113. ============================================
  114.    Texinfo has a variety of commands for specifying just what kind of
  115. object a piece of text refers to.  Metasyntactic variables, for
  116. example, are marked by one @-command and code by another.  Texinfo uses
  117. this information to determine how to highlight the text.  Since the
  118. pieces of text are labelled by commands that tell what kind of object
  119. they are, it is easy to change the way Texinfo formats and typesets
  120. such text.  For example, code is usually illustrated in a typewriter
  121. font, but it would be easy to change the way Texinfo highlights code to
  122. use another font.  This change would not effect how metasyntatic
  123. variables are highlighted.  If straight typesetting commands were used
  124. in the body of the file, you would have to check every single
  125. occurrence to make sure that you were changing code and not something
  126. else that should not be changed.
  127.    In addition, the commands can be used to generate useful information
  128. from the file, such as lists of functions or file names.  It is
  129. possible, for example, to write code in Emacs Lisp (or a keyboard
  130. macro) to insert an index entry after every paragraph that contains the
  131. text labelled by a specified command.  You could do this to construct
  132. an index of functions if you had not already made the entries.
  133.    The commands serve a variety of purposes:
  134. `@code'
  135.      Indicates text that is a literal example of a piece of a program.
  136. `@samp'
  137.      Indicates text that is a literal example of a sequence of
  138.      characters.
  139. `@file'
  140.      Indicates the name of a file.
  141. `@kbd'
  142.      Indicates the names of keys on the keyboard or characters you type.
  143. `@key'
  144.      Used for the conventional name for a key on a keyboard.
  145. `@ctrl'
  146.      Indicates an ASCII control character.
  147. `@var'
  148.      Indicates a metasyntactic variable.
  149. `@dfn'
  150.      Indicates the introductory or defining use of a term.
  151. `@cite'
  152.      Indicates the name of a book.
  153. * Menu:
  154. * Code::    A literal example of a piece of a program.
  155. * Samp::    A literal example of a sequence of characters.
  156. * File::    The name of a file.
  157. * Kbd::        The names of keys or else characters you type.
  158. * Key::        The conventional name for a key on a keyboard.
  159. * Ctrl::    Indicates the ASCII control character.
  160. * Var::        A variable.
  161. * Dfn::        The introductory or defining use of a term.
  162. * Cite::    The name of a book.
  163. File: texinfo,  Node: Code,  Next: Samp,  Up: Specifying
  164. @code
  165. -----
  166.    `@code' is used to indicate text that is a piece of a program which
  167. consists of entire syntactic tokens.  The text follows, enclosed in
  168. braces.
  169.    For example, `@code' is used for an expression in a program, the name
  170. of a variable or function used in a program, or a keyword.  `@code' is
  171. not used for a piece of a token, such as when speaking about the
  172. characters used in a token; for example, when you are explaining what
  173. letters or printable symbols can be used in the names of functions.  It
  174. is also not used for input to programs unless the input is written in a
  175. language that is like a programming language.  For example, it is not
  176. used for the single character commands of GNU Emacs although it is used
  177. for the names of Emacs Lisp functions that the keyboard commands invoke.
  178.    You should also `@code' for command names in command languages that
  179. resemble programming languages, such as Texinfo or the shell.  Note,
  180. however, that `@code' is not used for options such as `-c' when such
  181. options stand alone.  There is some argument as to whether an entire
  182. shell command incorporating an option should be written using `@code'
  183. or `@samp'.
  184.    It is an error to alter the case of a word inside an `@code'
  185. command.  This is a particularly insidious error if the language being
  186. documented is case sensitive.  If the command is `printf', then
  187. `Printf' is a misspelling.  If you do not like having such a command
  188. with lower case at the beginning of a sentence, you may wish to
  189. rearrange the sentence.
  190.    In the printed manual, `@code' puts the argument in bold face.  In
  191. the Info file, it uses `...' quotation.  For example:
  192.      To compare two files, showing text inserted or removed, use @code{diff}.
  193. produces
  194.      To compare two files, showing text inserted or removed, use `diff'.
  195. File: texinfo,  Node: Samp,  Next: File,  Prev: Code,  Up: Specifying
  196. @samp
  197. -----
  198.    `@samp' is used to indicate text that is a literal example of a
  199. sequence of characters in a file, string, pattern, etc.  The text
  200. follows, enclosed in braces.  The argument appears within `...'
  201. quotation in both the Info file and the printed manual; in addition, it
  202. is printed in a fixed-width font.
  203.      To match @samp{foo} at the end of the line, use the regexp @samp{foo$}.
  204. produces
  205.      To match `foo' at the end of the line, use the regexp `foo$'.
  206.    Any time you are referring to single characters, you should use
  207. `@samp' unless `@kbd' is more appropriate.  Basically, `@samp' is a
  208. catchall for whatever is not covered by `@code', `@file', `@kbd'.
  209.    Punctuation marks that are part of the English text that surrounds
  210. the strings you are specifying are *never* included within the braces.
  211. In the following sentence, for example, the commas and period are
  212. outside of the braces:
  213.      A symbol name ends in @samp{a}, @samp{b}, or @samp{c}.
  214. File: texinfo,  Node: File,  Next: Kbd,  Prev: Samp,  Up: Specifying
  215. @file
  216. -----
  217.    `@file' is used to indicate text that is the name of a file or
  218. directory.  Currently, it is equivalent to `@samp' in its effects on
  219. the output.  For example,
  220.      The @file{.el} files are in
  221.      the @file{/gnu/emacs/lisp} directory.
  222. produces
  223.      The `.el' files are in the `/gnu/emacs/lisp' directory.
  224. File: texinfo,  Node: Kbd,  Next: Key,  Prev: File,  Up: Specifying
  225.    `@kbd' is used much like `@code'.  The difference is that `@kbd' is
  226. for names of keys on the keyboard, or of characters you can type.  For
  227. example, to refer to the command `M-a', you would use
  228.      @kbd{M-a}
  229. and to refer to `M-x shell', you would use
  230.      @kbd{M-x shell}
  231.    The `@kbd' command has the same effect as `@code' in Info, but may
  232. produce a different font in a printed manual.
  233.    You can embed another @-command inside the braces of a `@kbd'
  234. command.  This is the way to describe a command that would be described
  235. more verbosely as "press an `r' and then press the RET key":
  236.      @kbd{r @key{RET}}
  237. This produces: `r RET'
  238.    You also use the `@kbd' command if you are spelling out the letters
  239. you type; for example:
  240.      To give the @code{logout} command,
  241.      type the characters @kbd{l o g o u t @key{RET}}.
  242. This produces
  243.      To give the `logout' command, type the characters `l o g o u t
  244.      RET'.
  245. File: texinfo,  Node: Key,  Next: Ctrl,  Prev: Kbd,  Up: Specifying
  246.    `@key' is used for the conventional name for a key on a keyboard, as
  247.      @key{RET}
  248.    Often, `@key' is used within the argument of a `@kbd' command,
  249. whenever the sequence of characters to be typed includes one or more
  250. keys that are described by name.
  251.    For example, to produce `C-x ESC' you would use
  252.      @kbd{C-x @key{ESC}}
  253.    The recommended names to use for keys are in upper case and are
  254.      Space.
  255.      Return.
  256.      Linefeed.
  257.      Tab.
  258.      Backspace.
  259.      Escape.
  260.      Delete.
  261.      Shift.
  262.      Control.
  263.      Meta.
  264.    There are subtleties to handling words like `meta' or `ctrl' which
  265. are names of shift keys.  When mentioning a character in which the
  266. shift key is used, such as `Meta-a', use the `@kbd' command alone
  267. without the `@key' command, but when you are referring to shift key in
  268. isolation, use the `@key' command.  For example, you would use
  269. `@kbd{Meta-a}' to produce `Meta-a' and `@key{META}' to produce META.
  270. File: texinfo,  Node: Ctrl,  Next: Var,  Prev: Key,  Up: Specifying
  271. @ctrl
  272. -----
  273.    `@ctrl' is used to describe an ASCII control character.  The pattern
  274. of usage is `@ctrl{CH}', where CH is an ASCII character whose
  275. control-equivalent is wanted.  Thus, you put in an `f' when you want to
  276. indicate a `control-f'
  277.    Thus, to specify `control-f', you would enter
  278.      @ctrl{f}
  279. which produces
  280.     &f
  281.    In the Info file, this generates the specified control character,
  282. output literally into the file.  This is done so a user can copy the
  283. specified control character (along with whatever else he or she wants)
  284. into another Emacs buffer and use it.  Since the
  285. `control-h',`control-i', and `control-j' characters are formatting
  286. characters, they should not be indicated this way.
  287.    In a printed manual, this generates text to describe or identify that
  288. control character: an uparrow followed by the character CH.
  289. File: texinfo,  Node: Var,  Next: Dfn,  Prev: Ctrl,  Up: Specifying
  290.    `@var' is used to indicate metasyntactic variables.  A metasyntactic
  291. variable is something that stands for another piece of text.  You would
  292. use a metasyntactic variable in the documentation of a function to
  293. describe the arguments that are passed to that function.
  294.    `@var' is not used for names of particular variables in programming
  295. languages.  For example, the Texinfo variable `texinfo-tex-command' is
  296. not a metasyntactic variable.
  297.    Its effect in the Info file is to upcase the argument; in the printed
  298. manual, to italicize it.  Example:
  299.      To delete file @var{filename}, type @code{rm @var{filename}}.
  300. produces
  301.      To delete file FILENAME, type `rm FILENAME'.
  302.    In some documentation styles, metasyntactic variables are shown with
  303. angle brackets, for example:
  304.      ..., type rm <filename>
  305. File: texinfo,  Node: Dfn,  Next: Cite,  Prev: Var,  Up: Specifying
  306.    `@dfn' is used to identify the introductory or defining use of a
  307. technical term.  The command should be used only in a passage whose
  308. purpose is to introduce a term which will be used again or which the
  309. reader ought to know.  Mere passing mention of a term for the first
  310. time doesn't deserve `@dfn'.  It generates italics in the printed
  311. manual, and double quotation marks in the Info file.  Example:
  312.      Getting rid of a file is called @dfn{deleting} it.
  313. produces
  314.      Getting rid of a file is called "deleting" it.
  315. File: texinfo,  Node: Cite,  Prev: Dfn,  Up: Specifying
  316. @cite
  317. -----
  318.    `@cite' is used for the name of a book.  It produces italics in the
  319. printed manual, and quotation marks in the Info file.
  320. File: texinfo,  Node: Braces Atsigns Periods,  Next: Dots Bullets Tex,  Prev: Specifying,  Up: Marking Text
  321. Inserting Braces, `@' and Periods
  322. =================================
  323.    `@' and curly braces are special characters in Texinfo.  This means
  324. that you have to put an `@' in front of these characters in order to
  325. insert them into text.
  326.    Periods are also special.  Depending on whether the period is inside
  327. of or at the end of a sentence, less or more space is inserted after a
  328. period in a typeset manual.  Since it is not always possible for
  329. Texinfo to determine when a period ends a sentence and when it is used
  330. in an abbreviation, special commands are needed.  (Usually, Texinfo
  331. figures out how to handle periods, so you don't have to use the special
  332. commands; you just enter a period as you would if you were using a
  333. typewriter, which means you put two spaces after the period that ends a
  334. sentence and after a colon.)
  335. * Menu:
  336. * Inserting an Atsign::        inserting an atsign.
  337. * Insert Left Brace::        Inserting a left brace.
  338. * Insert Colon::        Preventing unintended additional whitespace.
  339. * Insert Period::         Inserting a period that does end a sentence.
  340. File: texinfo,  Node: Inserting An Atsign,  Next: Insert Left Brace,  Up: Braces Atsigns Periods
  341.    `@@' stands for a single @ in either printed or Info output.
  342. File: texinfo,  Node: Insert Left Brace,  Next: Insert Colon,  Prev: Inserting an Atsign,  Up: Braces Atsigns Periods
  343.    `@{' stands for a single { in either printed or Info output.
  344.    `@}' stands for a single } in either printed or Info output.
  345. File: texinfo,  Node: Insert Colon,  Next: Insert Period,  Prev: Insert Left Brace,  Up: Braces Atsigns Periods
  346.    `@:' is used after a character such as period or colon which
  347. normally causes TeX to increase the width of the following whitespace,
  348. to suppress that effect.  For example, it can be used after periods that
  349. end abbreviations and do not end sentences.  `@:' has no effect on the
  350. Info file output.
  351.      It displays @code{Foo:}@: at that time.
  352. produces
  353.      It displays `Foo:' at that time.
  354.    The meanings of `@:' and `@.' in Texinfo are designed to work well
  355. with the Emacs sentence motion commands.  This means they are different
  356. from their meanings in some other formatting systems that use
  357. @-commands.
  358. File: texinfo,  Node: Insert Period,  Prev: Insert Colon,  Up: Braces Atsigns Periods
  359.    `@.' stands for a period that really does end a sentence, useful
  360. when TeX would otherwise assume by its heuristics that that is not so.
  361. This happens when there is a single-capital-letter word at the end of a
  362. sentence: TeX normally guesses that it is an abbreviation.
  363.    In the Info file output, `@.' is equivalent to a simple `.'.  The
  364. Texinfo program preserves the amount of space that you use, so put two
  365. spaces after a period if you intend it to be the end of a sentence (as
  366. well as using `@.', if necessary, for the printed manual's sake).
  367.      Give it to X. Give it to X@.  Give it to X@.
  368. produces
  369.      Give it to X. Give it to X.  Give it to X.
  370. File: texinfo,  Node: Dots Bullets Tex,  Next: Emphasis,  Prev: Braces Atsigns Periods,  Up: Marking Text
  371. Inserting Dots, Bullets and TeX
  372. ===============================
  373.    An ellipsis, a line of dots, is typeset differently than a string of
  374. periods; more whitespace is put between the dots in the ellipsis than is
  375. put between the periods.  Because of this, a special command is used in
  376. Texinfo for inserting dots.  Also, the trademark, TeX, is typeset in a
  377. special fashion and it needs an @-command, as does the command for
  378. inserting the copyright symbol.  The `@bullet' command is special, too.
  379. Each of these commands is followed by a pair of braces, `{}', without
  380. any whitespace between the name of the command and the braces.
  381. * Menu:
  382. * Dots::        Inserting dots.
  383. * Bullet::        Inserting bullets.
  384. * Tex::            Inserting the TeX trademark.
  385. File: texinfo,  Node: Dots,  Next: Bullet,  Up: Dots Bullets Tex
  386. @dots{}
  387. -------
  388.    `@dots{}' generates an ellipsis which is three dots in a row,
  389. appropriately spaced, like this: `...'.  Do not simply write three
  390. periods in the input file; that would work for the Info file output, but
  391. would produce the wrong amount of space between the periods in the
  392. printed manual.
  393. File: texinfo,  Node: Bullet,  Next: Tex,  Prev: Dots,  Up: Dots Bullets Tex
  394. @bullet{}
  395. ---------
  396.    `@bullet{}' generates a large round dot, or the closest possible
  397. thing to one.
  398.    Here is a bullet: *
  399. File: texinfo,  Node: Tex,  Prev: Bullet,  Up: Dots Bullets Tex
  400. @TeX{}
  401. ------
  402.    `@TeX{}' generates `TeX'.  In a printed manual, this is a special
  403. logo that is different from three ordinary letters.
  404. File: texinfo,  Node: Emphasis,  Prev: Dots Bullets Tex,  Up: Marking Text
  405. Emphasizing Text
  406. ================
  407.    Usually, Texinfo changes the font automatically to mark words in the
  408. text according to what category the words belong to.  The `@code'
  409. command, for example, does this.  Most often, this is the best way to
  410. mark specified words.  However, sometimes you will want to emphasize
  411. text directly.  Texinfo has two ways to do this: commands that tell
  412. Texinfo to emphasize the text but leave the method to the program, and
  413. commands that specify the font to use.  The first method is generally
  414. the best and it makes it possible to change the style of a document
  415. without have to re-edit it line by line.
  416. * Menu:
  417. * Emph and Strong::    Emphasizing text.
  418. * Fonts::        Selecting italic, bold or typewriter fonts.
  419. File: texinfo,  Node: Emph and Strong,  Next: Fonts,  Up: Emphasis
  420. @emph and @strong
  421. -----------------
  422.    `@emph' and `@strong' are two forms of emphasis.  `@strong' is
  423. stronger.
  424.    In printed output, `@emph' produces *italics* and `@strong' produces
  425. *bold*.
  426.    In the Info file, both of these commands put asterisks around the
  427. argument.
  428. File: texinfo,  Node: Fonts,  Prev: Emph and Strong,  Up: Emphasis
  429. @i,  @b and @t
  430. --------------
  431.    These three commands specify font changes in the printed manual and
  432. have no effect in the Info file.  `@i' requests italic font (in some
  433. versions of TeX, a slanted font is used), `@b' requests bold face, and
  434. `@t' requests the fixed-width font used by `@kbd'.  All three commands
  435. apply to an argument that follows, surrounded by braces.
  436.    If possible, you should avoid using these three commands.  If you
  437. find a need to use one, it probably indicates a lack in the Texinfo
  438. language.
  439. File: texinfo,  Node: Conditionals,  Next: Printing Hardcopy,  Prev: Marking Text,  Up: Top
  440. Conditionals
  441. ************
  442.    You may not always be able to use the same text for both the printed
  443. manual and the on-line Info file.  In this case, you can use the
  444. conditional commands to specify which text is for the printed manual
  445. and which is for the Info file.
  446.    `@ifinfo' begins text that should be ignored by TeX when it typesets
  447. the printed manual.  The text appears only in the Info file.  The
  448. `@ifinfo' command should appear on a line by itself.  End the info-only
  449. text with a line containing `@end ifinfo' by itself.  At the beginning
  450. of a Texinfo file, the Info permissions are contained within a region
  451. marked by `@ifinfo' and `@end ifinfo'.
  452.    Likewise, `@iftex' and `@end iftex' lines delimit text that will not
  453. appear in the Info file but will appear in the printed manual.
  454.    For example,
  455.      @iftex
  456.      This text will appear only in the printed manual.
  457.      @end iftex
  458.      
  459.      
  460.      @ifinfo
  461.      However, this text will appear only in the info manual.
  462.      @end ifinfo
  463. The preceding example produces the following.  Note how you only see
  464. one of the two lines, depending on whether you are reading the on-line
  465. Info version or the printed version of this manual.
  466.    However, this text will appear only in the info manual.
  467.    The `@titlepage' command is a special variant of `@iftex' that is
  468. used for making the title and copyright pages of the printed manual.
  469. * Menu:
  470. * Using Tex Commands::        Using commands from regular TeX.
  471. File: texinfo,  Node: Using Tex Commands,  Prev: Conditionals,  Up: Conditionals
  472. Using TeX Commands
  473. ==================
  474.    Inside a region delineated by `@iftex' and `@end iftex', you can
  475. embed ordinary TeX commands.  Info will ignore these commands since
  476. they are only in that part of the file that is seen by TeX.  The TeX
  477. commands are the same as any TeX commands except that an `@' replaces
  478. the `\' used by TeX.  For example, in the `@titlepage' section of a
  479. Texinfo file, the TeX command `@vskip' is used to format the copyright
  480. page.
  481.    You can enter TeX completely, and use `\' in the TeX commands by
  482. delineating a region with the `@tex' and `@end tex' commands.  (These
  483. commands automatically put the region inside of `@iftex' and `@end
  484. iftex' commands.)  For example,
  485.      @tex
  486.      Here you would put text with TeX commands;
  487.      such as $\bigl(x\in A(n)\bigm|x\in B(n)\bigr)$
  488.      that will appear only  in the printed manual.
  489.      @end tex
  490. In the Info file, nothing between `@tex' and `@end tex' will appear.
  491. File: texinfo,  Node: Printing Hardcopy,  Next: Creating an Info File,  Prev: Conditionals,  Up: Top
  492. Printing Hardcopy
  493. *****************
  494.    There are three shell commands for printing a hardcopy of a Texinfo
  495. file.  One is for formatting the file, the second is for sorting the
  496. index and the third is for printing the formatted document.  When you
  497. use the shell commands, you can either work directly in the operating
  498. system shell or work within a shell inside of GNU Emacs.
  499.    The typesetting program TeX is used for formatting a Texinfo file.
  500. TeX is a very powerful typesetting program and, if used right, does an
  501. exceptionally good job.  The @-commands in a Texinfo file are translated
  502. by a file called `texinfo.tex' into commands that TeX understands.
  503. (That is why the beginning of every Texinfo file starts with the line
  504. that says `\input texinfo'; this command tells TeX to use the
  505. `texinfo.tex' file in processing the Texinfo file.  Customarily,
  506. `texinfo.tex' is in a directory called `/usr/lib/tex/macros'.)
  507. `texinfo-format-buffer' reads the very same @-commands in the Texinfo
  508. file and processes them differently from TeX to make an Info file.
  509.    Usually, the TeX formatting command is the shell command `tex'
  510. followed by the name of the Texinfo file.  The TeX command produces a
  511. formatted DVI file as well as several auxiliary files containing
  512. indices, cross references, etc.  The DVI file (for "DeVice Independent"
  513. file) can be printed on a wide variety of printers.
  514.    The TeX formatting command itself does not sort the indices.  This
  515. is a misfeature of TeX.  Hence, to generate a printed index, you first
  516. need a sorted index to work from.
  517.    TeX outputs raw, unsorted index files under names that obey a
  518. standard convention.  These names are the name of your main input file
  519. to TeX, with everything after the first period thrown away, and the two
  520. letter names of indices added at the end.  For example, the raw index
  521. output files for the input file `foo.texinfo' would be `foo.cp',
  522. `foo.vr', `foo.fn', `foo.tp', `foo.pg' and `foo.ky'.  Those are exactly
  523. the arguments to give to `texindex'.  Or else, you can use `??' as
  524. "wild-cards" and give the command in this form:
  525.      texindex foo.??
  526.    For each file specified, `texindex' generates a sorted index file
  527. whose name is made by appending `s' to the input file name.  The
  528. `@printindex' command knows to look for a file of that name.
  529. `texindex' does not alter the raw index output file. After you have
  530. sorted the indices, you need to rerun the TeX command on the Texinfo
  531. file.  This regenerates a formatted DVI file with the index entries in
  532. the correct order.
  533.    To summarize, this is a three step process:
  534.   1. Run the TeX command on the Texinfo file.  This generates the
  535.      formatted DVI file as well as the raw index files with two letter
  536.      extensions.
  537.   2. Run the shell command `texindex' on the raw index files to sort
  538.      them.  The arguments to `texindex' are the names of the raw index
  539.      files.  `texindex' creates sorted index files whose names are the
  540.      names of the raw index files with an `s' appended.  To cause
  541.      `texindex' to sort all the raw index files, append `??' to the
  542.      Texinfo file name in place of the `.texinfo' extension.
  543.   3. Rerun the TeX command on the Texinfo file.  This regenerates a
  544.      formatted DVI file with the index entries in the correct order.
  545.      This second run also makes all the cross references correct as
  546.      well.  (The tables of contents are always correct.)
  547.    You need not run `texindex' after each TeX run.  If you don't, the
  548. next TeX run will use whatever sorted index files happen to exist from
  549. the previous use of `texindex'.  This is usually ok while you are
  550. debugging.
  551.    Finally, the document can be printed out with the DVI print command
  552. (a shell command).  Depending on the system used, the DVI print command
  553. will be a command such as `lpr -d'.  The DVI print command may require
  554. a file name without any extension or with a `.dvi' extension.
  555.    The following commands, for example, sort the indices, format and
  556. print the `Bison Manual' (where `%' is the shell prompt):
  557.      % tex bison.texinfo
  558.      % texindex bison.??
  559.      % tex bison.texinfo
  560.      % lpr -d bison.dvi
  561. (Remember that the words for the shell commands may be different at your
  562. site; but these are commonly used versions.)
  563.    It is often most convenient to give formatting and printing commands
  564. from a shell within GNU Emacs.  This way, you can easily keep track of
  565. errors.  To create a shell within Emacs, type `M-x shell'.  In this
  566. shell, you can format and print the document.  You can switch to and
  567. from this shell while it is running and do other things.  If you are
  568. formatting a very long document on a slow machine, this can be very
  569. convenient; on a VAX 750, for example, formatting often takes 8 seconds
  570. or more per page depending on how loaded the computer is.  Faster
  571. machines take correspondingly less time.
  572. * Menu:
  573. * Requirements::    Formatting requirements.
  574. * Compile-Command::    Formatting with the compile command.
  575. File: texinfo,  Node: Requirements,  Next: Compile-Command,  Up: Printing Hardcopy
  576. Formatting Requirements
  577. =======================
  578.    Every Texinfo file that is to be input to TeX must begin with a line
  579. that looks like
  580.      \input texinfo   @c -*-texinfo-*-
  581. This serves two functions.
  582.   1. When the file is processed by TeX, it loads the macros needed for
  583.      processing a Texinfo file.
  584.   2. When the file is edited in Emacs, it causes Texinfo mode to be
  585.      used.
  586.    Every Texinfo file must end with a line saying
  587.      @bye
  588.    which terminates TeX processing and forces out unfinished pages.
  589.    You also have to include two lines that specify the Info file name
  590. and the title of the printed manual:
  591.      @setfilename NAME-OF-TEXINFO-FILE
  592.      @settitle NAME OF MANUAL
  593.    You might also want to include a line saying
  594.      @setchapternewpage odd
  595. to cause each chapter to start on a fresh odd-numbered page.
  596.    By default, TeX typesets pages for printing in an 8.5 by 11 inch
  597. format.  However, you can direct TeX to typeset a document in a 7 by
  598. 9.25 inch format that is suitable for bound books by inserting the
  599. following command on a line by itself at the beginning of the Texinfo
  600. file, before the `@setchapternewpage' command:
  601.      @smallbook
  602. The Free Software Foundation distributes printed copies of the `GNU
  603. Emacs Manual' in this size.
  604.    Finally, TeX sometimes is unable to typeset a line without extending
  605. it into the right margin.  This can occur when TeX comes upon what it
  606. interprets as a long word that it cannot hyphenate, like a net address,
  607. or a very long title.  When this happens, TeX prints an error message
  608. like this:
  609.      Overfull \hbox (20.76302pt too wide)
  610. and gives the line number along with the text of the offending line
  611. marked at all the places that TeX knows to hyphenate words.  (In TeX
  612. lines are in `horizontal boxes', hence the term, `hbox'.)
  613.    If the Texinfo file has an overfull hbox, you can rewrite the
  614. sentence so the overfull hbox does not occur or you can decide to leave
  615. it.  A small excursion into the right margin often does not matter and
  616. may not even be noticable.  However, unless told otherwise, TeX will
  617. print a large, ugly, black rectangle beside every line that is
  618. overfull.  This is so you will notice the location of the problem if
  619. you are correcting a draft.  To prevent such monstrosities from marring
  620. your final printout, put the following in the beginning of the Texinfo
  621. file on lines of their own, before the `@setchapternewpage' command:
  622.      @iftex
  623.      @finalout
  624.      @end iftex
  625.    *Note Titlepage::, for information about creating a title page.
  626. *Note Contents::, for information about creating a table of contents.
  627. File: texinfo,  Node: Compile-Command,  Prev: Requirements,  Up: Printing Hardcopy
  628. Using Local Variables and the Compile Command
  629. =============================================
  630.    Another way to give the TeX formatting command to Texinfo is to put
  631. that command in a "local variables list" at the end of the Texinfo file.
  632. You can then specify the TeX formatting command as a `compile-command'
  633. and have Emacs run the TeX formatting command by giving the command
  634. `M-x compile'.  This creates a special shell called the `*compilation
  635. buffer*'.  For example, at the end of the `gdb.texinfo' file, after the
  636. `@bye', you would put the following:
  637.      @c Local Variables:
  638.      @c compile-command: "tex gdb.texinfo"
  639.      @c End:
  640. This technique is most often used by programmers who compile programs
  641. this way.
  642. File: texinfo,  Node: Creating an Info File,  Next: Catching Mistakes,  Prev: Printing Hardcopy,  Up: Top
  643. Creating an On-line Info file
  644. *****************************
  645.    In GNU Emacs, using Texinfo mode, you can see what part or all of a
  646. Texinfo file will look like in Info by using the keyboard command `C-c
  647. C-f' (`texinfo-format-region').  This formats a region and displays in a
  648. temporary buffer called `*Info Region*'; however, this command does not
  649. turn on Info reading program--it just displays what the region will
  650. look like.  The `texinfo-format-region' command is described more
  651. extensively in the chapter on using Texinfo mode.  *Note Info on a
  652. Region::.
  653.    In GNU Emacs, the way to create a working Info file is to visit the
  654. file and invoke
  655.      `M-x texinfo-format-buffer'
  656. A new buffer is created and the Info file text is generated there.
  657. `C-x C-s' will save it under the name specified in the `@setfilename'
  658. command.
  659.    If the Texinfo file has more than 30,000 bytes,
  660. `texinfo-format-buffer' will automatically create a "tag table" for it.
  661. With a tag table, Info can jump to new nodes more quickly than it can
  662. otherwise.  In addition, if the file has more than 100,000 bytes in it,
  663. `texinfo-format-buffer' will split the file into shorter Indirect
  664. subfiles of about 50,000 bytes each.  Files are split so that Info does
  665. not have to make a large buffer to hold the whole of a large Info file;
  666. instead, Info allocates just enough memory for the small, split off file
  667. that is needed at the time.  This way, Emacs avoids wasting memory when
  668. you run Info.  (Before splitting was implemented, Info files were
  669. always short and "include" files were designed as a way to create a
  670. single, large printed manual out of the smaller Info files. *Note
  671. Include Files::, for more information.)
  672.    When the file is split, Info itself works through a shortened
  673. version of the original file that contains the tag table and references
  674. to the files that were split off.  The split off files are called
  675. "indirect" files.
  676.    The split off files have names that are created by appending `-1',
  677. `-2', `-3' and so on to the file names specified by the `@setfilename'
  678. command.  The shortened version of the original file continues to have
  679. the name specified by `@setfilename'.
  680.    At one stage in writing this document, for example, the Info file
  681. was saved as `test-texinfo' and that file looked like this:
  682.      Info file: test-texinfo,    -*-Text-*-
  683.      produced by texinfo-format-buffer
  684.      from file: new-texinfo-manual.texinfo
  685.      
  686.      ^_
  687.      Indirect:
  688.      test-texinfo-1: 102
  689.      test-texinfo-2: 50422
  690.      test-texinfo-3: 101300
  691.      ^_^L
  692.      Tag table:
  693.      (Indirect)
  694.      Node: overview^?104
  695.      Node: info file^?1271
  696.      Node: printed manual^?4853
  697.      Node: conventions^?6855
  698.      ...
  699. (But `test-texinfo' had far more nodes than are shown here.)  Each of
  700. the split off, indirect files, `test-texinfo-1', `test-texinfo-2', and
  701. `test-texinfo-3', is listed in this file after the line that says
  702. `Indirect:'.  The tag table is listed after the line that says `Tag
  703. table:'.
  704.    You cannot run the `M-x Info-validate' node checking command on
  705. indirect files.  For information on how to prevent files from being
  706. split and how to validate the structure of the nodes, *note
  707. Info-Validating a Large File::.
  708. * Menu:
  709. * Installing an Info File::    Putting the Info file in the info directory.
  710. File: texinfo,  Node: Installing an Info File,  Prev: Creating an Info File,  Up: Creating an Info File
  711. Installing an Info file
  712. =======================
  713.    An Info file is usually installed in the GNU Emacs directory called
  714. `info'.  For Info to work, this directory must contain all the Info
  715. files, including the split off files.  In addition, the `info'
  716. directory must have a file that serves as a top level directory for the
  717. Info system.  This file is called `dir'.
  718.    For example, in the `info' directory, the file called `dir' has the
  719. top level menu for all the Info files in the system.  This file has a
  720. master menu that looks like this:
  721.      * Menu:
  722.      
  723.      * Info:    (info).      Documentation browsing system.
  724.      * Emacs:   (emacs).     The extensible self-documenting text editor.
  725.      * Texinfo: (texinfo).   With one source file, make either a printed
  726.                              manual using TeX or an Info file using
  727.                              Texinfo.
  728.    To add a new Info file, just add it to this menu.  For example, if
  729. you were adding documentation for GDB, you would make the following
  730. entry:
  731.      * GDB: (gdb).           The source-level C debugger.
  732. The first item is the menu item name; it is followed by a colon.  The
  733. second item is the name of the Info file, in parentheses; it is
  734. followed by a period.  The third part of the entry is the description
  735. of the item.
  736.    The top node of the file, named `top', should have as its parent the
  737. name of a node in another file, where there is a menu that leads to this
  738. file.  Specify the file name in parentheses.  If the file is to be
  739. installed directly in the Info directory file, use `(dir)' as the
  740. parent of the top node; this is short for `(dir)top', the node `top' in
  741. the file `dir', which is the main menu of Info.
  742. File: texinfo,  Node: Catching Mistakes,  Next: Command Syntax,  Prev: Creating an Info File,  Up: Top
  743. Catching Mistakes
  744. *****************
  745.    Besides mistakes with the content of what ever you are describing,
  746. there are two kinds of mistake you can make with Texinfo:  you can make
  747. mistakes with @-commands, and you can make mistakes with the structure
  748. of the nodes and chapters.
  749.    There are two tools for catching the first kind of mistake and two
  750. for catching the second.
  751.    For finding problems with @-commands, your best action is to run `M-x
  752. texinfo-format-region' on regions of your file as you write it.  In
  753. Texinfo mode, the `texinfo-format-region' command is bound to `C-c C-f'.
  754. In addition, you can run TeX on the whole file.
  755.    For finding problems with the structure of nodes and chapters, you
  756. can use `C-c C-s' (`texinfo-show-structure') (and the related `occur'
  757. command) and you can use the `M-x Info-validate' command.
  758. * Menu:
  759. * Debugging with Info::            Catching errors with info formatting.
  760. * Debugging with Tex::            Catching errors with TeX formatting.
  761. * Using texinfo-show-structure::    Using `texinfo-show-structure'
  762.                     to catch mistakes.
  763. * Running Info-Validate::        Checking for unreferenced nodes.
  764. File: texinfo,  Node: Debugging with Info,  Next: Debugging with Tex,  Up: Catching Mistakes
  765. Catching Errors with Info Formatting
  766. ====================================
  767.    After you have written part of a Texinfo file, you can use the `M-x
  768. texinfo-format-region' command to see whether the region formats
  769. properly.  In Texinfo mode, this command is bound to the keyboard
  770. command `C-c C-f'.
  771.    If you have made a mistake with an @-command, `M-x
  772. texinfo-format-region' will stop processing at or after the error and
  773. give an error message.  To see where in the file the error occurred,
  774. switch to the `*Info Region*' buffer; the cursor will be in a position
  775. that is after the location of the error.  Also, the text will not be
  776. formatted after the place the error occurred.
  777.    For example, if you accidently end a menu with the command `@end
  778. menus' with an `s' on the end, instead of with `@end menu', you will
  779. get an error message that says:
  780.      @end menus is not handled by texinfo.
  781. The cursor will stop at the point in the file where the error occurs, or
  782. not long after it.  It will look like this:
  783.      @menu
  784.      * Using texinfo-show-structure::    Using `texinfo-show-structure'
  785.                                          to catch mistakes.
  786.      * Running Info-Validate::           Checking for unreferenced nodes.
  787.      @end menus
  788.    The `texinfo-format-region' command does not always recognize errors.
  789. For example, no errors were reported when `texinfo-format-region' was
  790. run on the whole itemized list of which the following is a part:
  791.      name of the Texinfo file as an extension.  The @samp{??} are `wildcards'
  792.      that cause the shell to substitute all the raw index files.  (@xref{sorting
  793.      indices), for more information about sorting indices.) @refill
  794.      @cindex Sorting indices
  795.      @cindex Indices, sorting
  796.      
  797.      @item
  798.      @emph{Third}, rerun the @TeX{} command on the Texinfo file.  This
  799.      regenerates a formatted DVI file with the index entries in the correct
  800.      order.  This second run also makes all the cross references and table of
  801.      contents correct as well.
  802. Instead, `texinfo-format-region' ran without reporting the error, but
  803. it produced output with very long lines, containing some of the original
  804. `@cindex' commands mixed in.  (It is not practical to display these
  805. over long lines here.
  806.    However, when `texinfo-format-region' was run on part of the list
  807. that is shown, it did give an error message, `Search failed: "[{,}"'.
  808. (This error message is explained in the section on using the Emacs Lisp
  809. Debugger, *note Using the Emacs Lisp Debugger::.)
  810.    Sometimes `texinfo-format-region' will stop long after the original
  811. error;  this is because it does not discover the problem until then.
  812. In this case, you will have to backtrack.
  813. File: texinfo,  Node: Using the Emacs Lisp Debugger,  Up: Debugging with Info
  814. Using the Emacs Lisp Debugger
  815. -----------------------------
  816.    If an error is especially elusive, you can turn on the Emacs Lisp
  817. debugger and look at the backtrace; this tells you where in the
  818. `texinfo-format-region' function the problem occurred.  You can turn on
  819. the debugger with the command:
  820.      M-x set-variable RET debug-on-error RET t
  821. and turn it off with
  822.      M-x set-variable RET debug-on-error RET nil
  823.    Often, when you are using the debugger, it is easier to follow what
  824. is going on if you use the Emacs Lisp files that are not byte-compiled.
  825. The byte-compiled sources send octal numbers to the debugger that may
  826. look mysterious.  To use the uncompiled source files, load `texinfmt.el'
  827. and `texinfo.el' with the `M-x load-file' command.
  828.    The debugger will not catch an error if `texinfo-format-region' does
  829. not detect one.  In the example shown above, `texinfo-format-region'
  830. did not find the error when the whole list was formatted, but only when
  831. part of the list was formatted.  When `texinfo-format-region' did not
  832. find an error, the debugger did not find one either.
  833.    However, when `texinfo-format-region' did report an error, it invoked
  834. the debugger.  This is the backtrace it produced:
  835.      Signalling: (search-failed "[},]")
  836.        re-search-forward("[},]")
  837.        (while ...)
  838.        (let ...)
  839.        texinfo-format-parse-args()
  840.        (let ...)
  841.        texinfo-format-xref()
  842.        funcall(texinfo-format-xref)
  843.        (if ...)
  844.        (let ...)
  845.        (if ...)
  846.        (while ...)
  847.        texinfo-format-scan()
  848.        (save-excursion ...)
  849.        (let ...)
  850.        texinfo-format-region(103370 103631)
  851.      * call-interactively(texinfo-format-region)
  852.    The backtrace is read from the bottom up.  `texinfo-format-region'
  853. was called interactively; and it, in turn, called various functions,
  854. including `texinfo-format-scan', `texinfo-format-xref' and
  855. `texinfo-format-parse-args'.  Inside the function
  856. `texinfo-format-parse-args', the function `re-search-forward' was
  857. called; it was this function that could not find the missing right hand
  858. brace.
  859.    *Note Debugging Emacs Lisp: (emacs)Lisp Debug, for more information.
  860. File: texinfo,  Node: Debugging with Tex,  Next: Using texinfo-show-structure,  Prev: Debugging with Info,  Up: Catching Mistakes
  861. Catching Errors with TeX Formatting
  862. ===================================
  863.    You can also catch mistakes when you format a file with TeX.
  864.    Usually, you will want to do this after you have run
  865. `texinfo-format-buffer' on the same file.  `texinfo-format-buffer' is
  866. usually faster and sometimes gives error messages that make more sense.
  867. *Note Debugging with Info::, for more information.
  868.    For example, TeX was run on the same itemized list discussed in the
  869. section on the use of  `texinfo-format-region' (*note Debugging with
  870. Info::.); the fragment with the error looked like this:
  871.      name of the texinfo file as an extension.  The @samp{??} are `wildcards'
  872.      that cause the shell to substitute all the raw index files.  (@xref{sorting
  873.      indices, for more information about sorting indices.) @refill
  874. This produced the following output, after which TeX stopped:
  875.      Runaway argument?
  876.      {sorting indices, for more information about sorting indices.) @refill @ETC.
  877.      ! Paragraph ended before \xref was complete.
  878.      <to be read again>
  879.                         \par
  880.      l.27
  881.      
  882.      ?
  883.    In this case, TeX produced an accurate and understandable error
  884. message: `Paragraph ended before \xref was complete.' (Note, however,
  885. that TeX translated the `@' into a `\'.)  Also, `\par' is an internal
  886. TeX command of no relevance to Texinfo.)
  887.    Unfortunately, TeX is not always so helpful, and sometimes you have
  888. to be truly a Sherlock Holmes to discover what went wrong.
  889.    In any case, if you run into a problem like this, you can do one of
  890. two things.
  891.   1. You can tell TeX to continue running and to ignore errors as best
  892.      it can by typing `r RET' at the `?' prompt.
  893.      This is often the best thing to do.  However, beware: the one
  894.      error may produce a cascade of additional error messages as it
  895.      consequences are felt through the rest of the file.
  896.   2. You can tell TeX to stop this run by typing `x RET' at the `?'
  897.      prompt.
  898.    Sometimes TeX will format a file without producing error messages
  899. even though there is a problem.  This usually occurs if a command is
  900. not ended but TeX is able to continue processing anyhow.  For example,
  901. if you fail to end an itemized list with the `@end itemize' command,
  902. TeX will write a DVI file that you can print out.  The only error
  903. message that TeX will give you is the somewhat mysterious comment that
  904.      (\end occurred inside a group at level 1)
  905. However, if you print the DVI file, you will find that the text of the
  906. file that follows the itemized list is entirely indented as if it were
  907. part of the last item in the itemized list.  The error message is the
  908. way TeX says that it expected to find an `@end' command somewhere in the
  909. file; but that it could not locate where it was needed.
  910.    Another source of notoriously hard to find errors is a missing `@end
  911. group' command.  If you ever are stumped by incomprehensible errors,
  912. look for a missing `@end group' command first.
  913.    If you do not have the header lines in the file, TeX may stop in the
  914. beginning of its run and display output that looks like the following.
  915. The `*' indicates that TeX is waiting for input.
  916.      This is TeX, Version 2.0 for Berkeley UNIX (preloaded format=plain-cm
  917.      87.10.25) (#tz-bar-a02987.tex [1])
  918.      *
  919. In this case, simply type `\end RET' after the asterisk.  Then put the
  920. header lines into the Texinfo file and run the TeX command again.
  921.